﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ModelPredictPro.WindowForms.AppCodes;
using ModelPredictPro.Predict.SVM;

namespace ModelPredictPro.WindowForms.UserControls {
    public class SVMUserControl : System.Windows.Forms.UserControl, ISVMTaskHost {

        public virtual string TrainSetFile { get; set; }
        public virtual string TestSetFile { get; set; }
        public virtual string TrainValidateFile { get; set; }
        public virtual string ParamOutFile { get; set; }
        public virtual string ResultOutputFile { get; set; }

        public formTaskList TaskListForm { get; set; }


        public virtual event EventHandler< SVMTaskEvent> TaskAdded;

        public virtual ITask CreateTask() {
            return null;
        }
        public virtual void OnTaskAdded(SVMTaskEvent e){
            if( TaskAdded != null )
                TaskAdded(this, e);
        }
        protected void AddTask(ITask task) {
            UCConsole view = this.Tag as UCConsole;
            task.StepChanged += (sender, e) => {
                view.InvokePublishInfo(e);
            };
            OnTaskAdded(new SVMTaskEvent(task));
        }
    }
}
